import router from "./index";
import store from "../store/store";

router.beforeEach((to, from, next) => {
  if (to.matched.some((record) => record.meta.requiresAuth)) {
    if (store.state.token) {
      next();
    } else {
      next({ path: "/blogin" });
    }
  } else {
    next();
  }
});
